package com.example.user.client;

import com.example.user.config.FeignLogConfig;
import com.example.user.dto.ProductDTO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

/**
 * @Title: ProductClient
 * @Description: 调用product服务的接口
 * @Auther: brucewong
 * @Version: 1.0
 * @create 2019/10/10 21:30
 */
@FeignClient(name = "PRODUCT", fallbackFactory = ProductClientFallbackFactory.class)
//@FeignClient(name = "PRODUCT", fallback = ProductClientFallback.class)
//@FeignClient(name = "PRODUCT", configuration = FeignLogConfig.class)
public interface ProductClient {
    @GetMapping("/product/{id}")
    ProductDTO findProduct(@PathVariable("id") String id);

    @GetMapping("/product/find")
    ProductDTO findProduct(@RequestParam("id") String id, @RequestParam("name") String name);

    @PostMapping("/product/add")
    ProductDTO add(@RequestBody ProductDTO productDTO);
}
